<?php
class Model_promotion extends CI_Model{
    protected $_table = "tbl_promotions";
    public function __construct() {
        parent::__construct();
        $this->load->database();
    }
    public function get_all($cateid) {
        return $this->db
            ->where('promo_id !=',1)
			->where('cate_id',$cateid)
            ->get($this->_table)->result_array();
    }
    public function listall($off,$start){
        $this->db->order_by("id","DESC");
        $this->db->limit($off,$start);
        return $this->db->get($this->_table)->result_array();
    }
    public function getdata($id){
        $this->db->where("promo_id",$id);
        $query = $this->db->get($this->_table);
        return $query->row_array();
    }
	public function getdatare($id){
        $this->db->where("promo_rewrite",$id);
        $query = $this->db->get($this->_table);
        return $query->row_array();
    }
}
?>